Changing the I/O Buffer Size

The following example opens a file named SAMPLE.TXT for unbuffered I/O, and then enables buffered I/O with an internal 16K buffer using the mmioSetBufferWQ.XNI function.

HMMIO hFile;

 

if ((hFile = mmioOpen("SAMPLE.TXT", NULL, MMIO_READ)) != NULL)

    // File opened successfully; request an I/O buffer.

    if (mmioSetBuffer(hFile, NULL, 16384L, 0))

        // Buffer cannot be allocated.

    else

        // Buffer allocated successfully.

}

else

    // File cannot be opened.